public class DailyTest
{ public static void main (String [] args)
  {  // Create a DailySchedule object.
     DailySchedule d = new DailySchedule();

     // Create three different request objects. 
     // Note that a DailySchedule represents the schedules 
     // for one day of the week,     
     Request r1 = new Request("event1", "M", Convert.stringToTime("9:30am") , Convert.stringToTime("10:30am"),20);
     Request r2 = new Request("event2", "M", Convert.stringToTime("11:30am"), Convert.stringToTime("1:00pm"),20);
     Request r3 = new Request("event3", "M", Convert.stringToTime("1:30pm"), Convert.stringToTime("2:30pm"),20);
     Request r4 = new Request("event4", "M", Convert.stringToTime("10:30am"), Convert.stringToTime("11:00am"),20);

     // Add them to the DailySchedule 
     d.add(r1);
     d.add(r2);
     d.add(r3);
     d.add(r4);
     // Print the DailySchedule.
     // The following line is equivalent to 
     // System.out.println(d.toString()); //CS46A subject
     System.out.println(d);

     // Creates another request of which schedule does not conflict with any
     // exising ones. 
     Request r5 = new Request("event5", "M", Convert.stringToTime("1:00pm"), Convert.stringToTime("1:30pm"),20);
     // Check the availability 
     System.out.println(d.check(r5)); // should return true
     if (d.check(r5)) d.add(r5);
     // Creates another request of which schedule conflicts with any
     // exising ones. 
     Request r6 = new Request("event6", "M", Convert.stringToTime("11:30am"), Convert.stringToTime("1:30pm"),20);
     // Check the availability
     System.out.println(d.check(r6)); // should return false
     if (d.check(r6)) d.add(r6);
      
     // Print and see if r5 is correctly added. 
     System.out.println("after addition");
     System.out.println(d);
     // Cancel r1 
     d.cancel(r1);
     // Cancel r5 
     d.cancel(r5);
     // See if r1 and r5 are corretly cancelled. 
     System.out.println("after cancellation");
     System.out.println(d);
      
  }
}



